using DimensionsHelper.LanguageService.Syntax;

namespace DimensionsHelper.LanguageService;

public class AnalysisEmptyExpression : AnalysisExpression
{
    internal AnalysisEmptyExpression(AnalysisNode? parent) :
        base(AnalysisBoundKinds.EmptyExpression, EmptyExpression.Default, parent)
    {
    }
    
    public override bool IsEmpty => true;

    public override IEnumerable<AnalysisNode> GetChildren()
    {
        return [];
    }

    internal override void AddChild(AnalysisNode child)
    {
        throw new NotSupportedException("EmptyExpression cannot have children");
    }
}


public static partial class AnalysisNodeFactory
{
    /// <summary>
    /// 创建一个空表达式
    /// </summary>
    /// <param name="parent">父节点，可以忽略</param>
    public static AnalysisEmptyExpression EmptyExpression(AnalysisNode? parent)
    {
        return new AnalysisEmptyExpression(parent);
    }
}